home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games Extra 1996 June
/
Amiga Games Extra 1996 #6.iso
/
rexx
/
diskbuttons-1.dw
next >
Wrap
Text File
|
1996-03-23
|
6KB
|
263 lines
/*
** DirWorks ARexx Script
**
**
** This program will create two columns of buttons. One on each side of an
** overscan/non-interlaced DW-2 screen. Each button will hold a disk drive
** path or assignment.
*/
options results
parse arg config
bg.1=3 /* Background color pen for real drives/partitions */
co.1=2 /* Text color pen for real drives/partitions */
bg.2=6 /* Background color pen for assignments */
co.2=2 /* Text color pen for assignments */
/* Enter all the subdirectory segments you want skip. */
skip = 'asim adpro jpeg game bbs doors/ copiers Video: ca:'
/* Enter the assignments/drives you want to guarantee to be used */
force = 'S C ENV T REXX MyC MyNew Work UUCP UUMail UUSpool'
/* ------------------< CHANGE NOTHING BEYOND THIS POINT >------------------ */
if length(config)<1 then config='s:dw.cfg'
say ''
say ''
skip=upper(skip)
force=upper(force)
count=0
if open(infile,config,'r') then do
say 'Reading config "'config'"...'
t=readln(infile)
do while ~eof(infile)
if left(t,3)='B,x' then do
t2=translate(t,' _',', ')
do x=1 to words(t2)
t3=word(t2,x)
if left(t3,2)="t'" & right(t3,3)="'@D" & pos(' q$5 ',t2)>0 then t=''
if pos('h230',t3) then t=''
end
end
if length(t)>0 then do
count=count+1
line.count=t
end
t=readln(infile)
end
close(infile)
bcount=1
button.1='RAM' ; path.1='RAM:'
say 'Adding buttons...'
shell command 'info >t:dw-buttons.list1'
shell command 'sort t:dw-buttons.list1 TO t:dw-buttons.list'
if open(infile,'t:dw-buttons.list','r') then do
t=readln(infile)
do while ~eof(infile)
if words(t)>2 & right(word(t,1),1)=':' & word(t,1)~='RAM:' then do
t2=word(t,1)
t3=word(t,words(t))||':'
bcount=bcount+1
button.bcount=t2
path.bcount=t2
if left(t2,2)='DH' then do
button.bcount=strip(left(word(t3,1),7))
path.bcount=t3
end
end
t=readln(infile)
end
close(infile)
end
do x=1 to bcount
button.x=strip(translate(button.x,' ',':'))
end
start=bcount+1
used=''
shell command 'assign >t:dw-buttons.list1'
shell command 'sort t:dw-buttons.list1 t:dw-buttons.list'
if open(infile,'t:dw-buttons.list','r') then do
t=readln(infile)
do while ~eof(infile)
p=pos('RAM DISK:',upper(t))
if p>0 then t=overlay(' RAM:',t,p)
if word(t,1)~='+' & words(t)=2 & left(word(t,2),1)~='[' then do
bcount=bcount+1
button.bcount=strip(left(word(t,1),7))
path.bcount=word(t,2)
used=used' 'upper(word(t,2))
end
t=readln(infile)
end
close(infile)
end
shell command 'copy s:dw.cfg to s:dw.old.cfg'
if words(skip)>0 then do
say 'Removing unwanted buttons...'
x=start
do while x<=bcount
y=x-1
if button.y=button.x then do
if length(path.y)<length(path.x) then z=y; else z=x
button.z=button.bcount
path.z=path.bcount
bcount=bcount-1
end
SkipIt=0
z=1
do while z<=words(skip) & SkipIt=0
if pos(word(skip,z),upper(button.x' 'path.x))>0 then do
SkipIt=1
button.x=button.bcount
path.x=path.bcount
bcount=bcount-1
end
z=z+1
end
if SkipIt=0 then x=x+1
end
end
do qq=1 to bcount; shell command 'echo >>t:test "'qq'... 'button.qq'"'; end
shell command 'echo >>t:test ""'
if bcount>46 then do
say 'You have 'bcount' buttons... That is too many...'
say 'Sorting buttons by path...'
sorted=0
do while sorted=0
sorted=1
do x=start to bcount-1
y=x+1
if upper(path.x)>upper(path.y) then do
t=button.x
button.x=button.y
button.y=t
t=path.x
path.x=path.y
path.y=t
sorted=0
end
end
end
say 'Stripping any duplicate paths...'
x=start
do while x<bcount
y=x+1
if upper(path.x) = upper(path.y) then do
if pos(upper(button.x),force)<1 | pos(upper(button.y),force)<1 then do
if pos(upper(button.y),force)>0 then button.x=button.y
do z=y to bcount-1
zz=z+1
button.z=button.zz
path.z=path.zz
end
bcount=bcount-1
end; else x=x+1
end; else x=x+1
end
if bcount>46 then do
say 'There are now 'bcount' buttons... Still too many...'
say 'Trunkating the button list...'
y=start
z=bcount
do x=start to bcount
do while pos(upper(button.x),upper(force))>0 & y<bcount
t=button.x
button.x=button.y
button.y=t
t=path.x
path.x=path.y
path.y=t
y=y+1
end
end
bcount=46
end
end
say 'Sorting buttons by name...'
sorted=0
do while sorted=0
sorted=1
do x=start to bcount-1
y=x+1
if upper(button.x)>upper(button.y) then do
t=button.x
button.x=button.y
button.y=t
t=path.x
path.x=path.y
path.y=t
sorted=0
end
end
end
high=10
half=23
if bcount<46 then do
if bcount/2 ~= trunc(bcount/2) then do
bcount=bcount+1
button.bcount=''
path.bcount='RAM:'
end
half=bcount/2
high=trunc(230/half)
end
if open(outfile,config,'w') then do
say 'Writing config...'
do x=1 to count
writeln(outfile,line.x)
end
xx=0
yy=11
do x=1 to bcount
if x<start then z=1; else z=2
t="B,x"xx",y"yy",w60,h"high",c"co.z",b"bg.z",l2,d1,L1,D2,f'IBM.font'"
t=t||",s7,t'"button.x"'@D,q$5,n'"path.x"',v20,m$100002@D,q$11,n'"path.x
t=t||"',v20,m$100004"
writeln(outfile,t)
yy=yy+high
if x=half then do
yy=11
xx=659
end
end
close(outfile)
end
say 'Done...'
end
shell command 'delete <>NIL: t:dw-buttons.list#?'
shell command 'run <>NIL: rx "address ''DIRWORK_1''; ''X@X,v1,n'''''config'''''''"'